package com.wy.jetpack.activity;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import com.wy.jetpack.R;
import com.wy.jetpack.view.IChronometer;

public class LifecycleActivity extends AppCompatActivity {

    private IChronometer chronometer;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_lifecycle);

        chronometer=findViewById(R.id.chronometer);
        getLifecycle().addObserver(chronometer);

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        getLifecycle().removeObserver(chronometer);
    }
}
